package day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int score = 0;//总分
        for (int i=1;i<=10;i++){
            int num1 = (int)(Math.random()*100);
            int num2 = (int)(Math.random()*100);
            int result = num1+num2;
            System.out.println("("+i+")"+num1+"+"+num2+"=?");
            int num3 = sc.nextInt();
            if (num3==result){
                score+=10;
                System.out.println("答对了加10分,目前总分"+score);
            }else{
                score-=10;
                System.out.println("答错了减10分,目前总分"+score);
            }
        }
        System.out.println("总分为"+score);
    }
}
